Hi, I'm tony and this is my first post.
I'm developing my first android app.
I'm setting some properties for my "work in progress" application.
I use a xml properties connection to set some user information, but i'd like to store permanently some information like "last sync time" that the user has not to see or modify
Is it possible to let the user work with normal preferences screen and add and use some other hidden property? how?
Thanks
Take a look at Data Storage especially SharedPreferences they are really easy to use and store/retrieve persistant data.
Example:
To read
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
int lastSync = settings.getInt("lastSync", 0);
To write
SharedPreferences.Editor prefEditor = settings.edit();
prefEditor.putInt("lastSync", lastSync);
prefEditor.commit();
These settings will be stored until he deletes your application.
Does this help, if not provide further information, what you want to do.
Hi all,
i am working for VC++, please tell me how can i identify here the Windows Phone 7 is connected to PC By USB cable .
thanks in advance.
You should be more specific. Where you need identify connection: on the handset or on PC? BTW, C++ isn't supported by WP7 SDK (C# and VB only).
I want to identify connection on PC .
is there any option n c# to identify this please tell me.
AFAIK, there is no WP7 API or documentation for this from PC side (but probably you can find something in WinMo 6/6.5 SDK's), however you can monitor and detect Zune run or get background task on WP7 telling you what kind of connection handset is using right now.
P.S. Take a look to the http://msdn.microsoft.com/en-us/library/bb840031.aspx , also check this thread http://forum.xda-developers.com/showthread.php?t=1016766
I believe it's possible using Windows CE/Windows Mobile "old technique" ('cause WP7 based on WinCE 7.0 and CE services).
so please tell me how?
Also you can use Microsoft.Smartdevice.Connectivity assembly but it's not a best way (no events defined, you should pull device for connection periodically).
Code:
using Microsoft.SmartDevice.Connectivity;
static DeviceInfo[] GetDevices()
{
List<DeviceInfo> list = new List<DeviceInfo>();
try
{
DatastoreManager manager = new DatastoreManager(0x409);
foreach (Platform platform in manager.GetPlatforms())
foreach (Device device in platform.GetDevices())
list.Add(new DeviceInfo(platform.Id.ToString(), device.Id.ToString(), device.Name));
}
catch {}
return list.ToArray();
}
static bool IsDeviceConnected (DeviceInfo deviceInfo)
{
bool bResult = false;
try
{
DatastoreManager manager = new DatastoreManager(0x409);
Device device = manager.GetPlatform(new ObjectId(deviceInfo.PlatformId)).GetDevice(new ObjectId(deviceInfo.DeviceId));
bResult = device.IsConnected();
}
catch {}
return bResult;
}
Of course it's just a prototypes. Actually you need to get device once and periodically pull .IsConnected().
error ::comes when i use this.
error CS0234:The type or namespace name 'SmartDevice' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'DeviceInfo' could not be found (are you missing a using directive or an assembly reference?)
Click to expand...
Click to collapse
sensboston said:
AFAIK, there is no WP7 API or documentation for this from PC side (but probably you can find something in WinMo 6/6.5 SDK's), however you can monitor and detect Zune run or get background task on WP7 telling you what kind of connection handset is using right now.
P.S. Take a look to the http://msdn.microsoft.com/en-us/library/bb840031.aspx , also check this thread http://forum.xda-developers.com/showthread.php?t=1016766
I believe it's possible using Windows CE/Windows Mobile "old technique" ('cause WP7 based on WinCE 7.0 and CE services).
Click to expand...
Click to collapse
have u ever tried this ?
please help.
[email protected] said:
please help.
Click to expand...
Click to collapse
Watch this video, it will explain your needs completely!
P.S. Always try 2google first! Nobody will do your job for you...
thread moved to Q&A
I gotta say I'm a bit surprised by the lack of ambition to get a working 4G toggle. Every phone I've had, there has always been a demand to get a working 4G toggle. Has anyone heard of anything about this? Luckily this phone gets good battery life so its not that big of a deal but it'd be nice to have for those times when your trying to really save battery.
I know of the app Phone Info, but its gotten a lot of negative views around here about losing data with it so I've avoided it since.
rehpyc has been working on one. I've sent him some info that I discovered trying to find the right system call to switch between 3g and 4g.
Rather than simply be disappointed, would you like to help?
Sent from my SCH-I535 using xda premium
I'm trying to find where the settings (which can be accessed in the phone info -> Device Information area) are stored.
-Using dex2jar and jdgui, I decompiled the phone info app into java source (.java) files. It's a really small app that just calls the "TestingSettings" functionality of the SecSettings.apk
-We can access the "TestingSettings" by simply running "am start com.android.settings/.TestingSettings" in terminal. It essentially does the exact same thing as launching the Phone Info app.
-Using dex2jar and jdgui, I decompiled the SecSettings.apk into java source (.java) files. Digging through the files, I found that the RadioInfo class. This class contains a String array mPreferredNetworkLabels which lists all the settings in the spinner we choose the network type (CDMA Auto (PRL), LTE/CDMA/EvDo, etc). This class seems to provide functionality for listening to GUI changes on the "PreferredNetworkType" spinner. Not exactly sure what it does from there, but hopefully it can be traced down to some methods that either store the settings into a file or to a SQLite database.
In dex2jar -> JD gui for SecSettings.apk, Radioinfo class has
public RadioInfo()
{
String[] arrayOfString = new String[14];
arrayOfString[0] = "WCDMA preferred";
arrayOfString[1] = "GSM only";
arrayOfString[2] = "WCDMA only";
arrayOfString[3] = "GSM auto (PRL)";
arrayOfString[4] = "CDMA auto (PRL)";
arrayOfString[5] = "CDMA only";
arrayOfString[6] = "EvDo only";
arrayOfString[7] = "GSM/CDMA auto (PRL)";
arrayOfString[8] = "LTE/CDMA/EvDo";
arrayOfString[9] = "LTE/GSM/WCDMA";
arrayOfString[10] = "Global";
arrayOfString[11] = "LTE only";
arrayOfString[12] = "LTE/WCDMA";
arrayOfString[13] = "Unknown";
this.mPreferredNetworkLabels = arrayOfString;
}
RadioInfo.java sets the network type in the following code (lines 297-309):
AdapterView.OnItemSelectedListener mPreferredNetworkHandler = new AdapterView.OnItemSelectedListener()
{
public void onItemSelected(AdapterView paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
{
Message localMessage = RadioInfo.this.mHandler.obtainMessage(1001);
if ((paramAnonymousInt >= 0) && (paramAnonymousInt <= -2 + RadioInfo.this.mPreferredNetworkLabels.length))
RadioInfo.this.phone.setPreferredNetworkType(paramAnonymousInt, localMessage);
}
public void onNothingSelected(AdapterView paramAnonymousAdapterView)
{
}
};
The key line is line 303:
RadioInfo.this.phone.setPreferredNetworkType(paramAnonymousInt, localMessage);
Some info about the setPreferredNetworkType() method:
void setPreferredNetworkType(int networkType, Message response);
Requests to set the preferred network type for searching and registering (CS/PS domain, RAT, and operation mode)
Parameters:
networkType one of NT_*_TYPE
response is callback message
The phone data member is a private data member set to null on line 422:
private Phone phone = null;
The phone data member is set to the Default Phone on RadioInfo object creation (onCreate) in line 916:
this.phone = PhoneFactory.getDefaultPhone();
Based on the above information, I believe we would need to create a toggle which would execute a small java program to access the setPreferredNetworkType() method from a Phone object instantiated from the PhoneFactory.getDefaultPhone() method. I believe Phone resides in com.android.internal.telephony, but in order to gain access to the internal android stuff we would need to do something like the following article provides:
https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/
That's all the time I have for the moment...
great info! Unfortunately I have no idea how that stuff works. I praise the devs who do this work and members like you who work on it. I wish I could.
Sorry if I came off as demanding of wanting a toggle, I'm just surprised I haven't heard more about it. But good to know it's being worked on. I'd definitely be willing to help test when something is cooked up though
tu3218 said:
great info! Unfortunately I have no idea how that stuff works. I praise the devs who do this work and members like you who work on it. I wish I could.
Sorry if I came off as demanding of wanting a toggle, I'm just surprised I haven't heard more about it. But good to know it's being worked on. I'd definitely be willing to help test when something is cooked up though
Click to expand...
Click to collapse
Unfortunately I'm short on time these days, but I wanted to get the info out there so someone might be able to use it. I really do think we're close, but I'm more of a hacker/modder than an Android dev. Someone comfortable with development on Android might be able to speed this up significantly.
Sent from my SCH-I535 using xda premium
Use this one:
http://forum.xda-developers.com/android/apps-games/app-m2d-notifications-sender-receiver-t2986778
http://forum.xda-developers.com/android/apps-games/app-m2d-notifications-sender-receiver-t2986778
Developer Post:
Want to use M2D Manager for your own modules? Get rid of bluetooth connections and leave that for M2D Manager. Focus on your App.
In order to send a message between devices, the message goes first to M2D Manager with an Intent this way:
Intent i = new Intent("com.pacosal.m2d.manager.action.MSG");
i.setPackage("com.pacosal.m2d.manager");
i.putExtra("action", "Your receiver package and filter");
i.putExtra("data", "message");
sendBroadcast(i);
***********************************************************************************
** version 1.3.0
***********************************************************************************
Added feature to ask m2d Manager for connection state
Register for this filter in your ExternReceiver:
<action android:name="com.pacosal.m2d.manager.action.CONNECTION" />
and in your class use this code:
if (intent.getAction().equals("com.pacosal.m2d.manager.action.CONNECTION")) {
connectionState = intent.getBooleanExtra("connected", false);
return;
}
If you need to know the connection state, you can ask m2d manager with this code:
Intent i = new Intent("com.pacosal.m2d.manager.action.CONNECTION_STATE");
i.setPackage("com.pacosal.m2d.manager");
this.sendBroadcast(i);
***********************************************************************************
** version 1.2.0
***********************************************************************************
Added feature to send and receive binary files. Don't send binary files greater than 500.000 bytes.
To send:
intent.putExtra("binary",byte[]) ;
To receive:
byte[] dataBinary = intent.getByteArrayExtra("binary");
If you need sending greater files, send them with several messages and concatenate them.
***********************************************************************************
** version 1.1.0
***********************************************************************************
By default, M2D Manager stores messages if there is no connection between devices in real time, if for your App the message is only valid in real time, set the following flag. For instance for an instant action.
intent.putExtra("flagNoStore",true) ;
***********************************************************************************
The action parameter include the filter broadcast that the receiver App must implement.
The data parameter is a String message to send to your App. Could be any String text, including json
In order to receive the message in the other App (Could be the same App) M2D Manager send an Intent with the action text you sent before that you have to register in your manifest:
AndroidManifest
<receiver android:name="your_package.ExternReceiver" >
<intent-filter>
<action android:name="Your receiver package and filter" />
</intent-filter>
</receiver>
Class
public class ExternReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
// Do actions...
String data = intent.getStringExtra("data");
Log.D(TAG, data);
}
}
Remember including in Google Play description the sentence M2D My Second Device Module at the end in order that users can find your App from M2D Manager.
Thanks
pacosal said:
Galaxy Note 3 and show your Xperia U, por example.
Click to expand...
Click to collapse
spell mistake
concept is good,any chance of connection by internet rather than using Bluetooth,so that I can use it even when I m out?
coz otherwise I will have to be in Bluetooth range to make everything work ..
anu.cool said:
spell mistake
concept is good,any chance of connection by internet rather than using Bluetooth,so that I can use it even when I m out?
coz otherwise I will have to be in Bluetooth range to make everything work ..
Click to expand...
Click to collapse
Thanks for the mistake
The idea is wear always both devices, because the small one doesn't have SIM
Regards
pacosal said:
Thanks for the mistake
The idea is wear always both devices, because the small one doesn't have SIM
Regards
Click to expand...
Click to collapse
Pacosal my man,
Do both devices need to be running Android?
Could this happen between an iPhone and a Gear?
Thanks!
gidi said:
Pacosal my man,
Do both devices need to be running Android?
Could this happen between an iPhone and a Gear?
Thanks!
Click to expand...
Click to collapse
Sorry my friend, but only Android
pacosal said:
Thanks for the mistake
The idea is wear always both devices, because the small one doesn't have SIM
Regards
Click to expand...
Click to collapse
I don't know anything about coding and all,but it maybe possible to take the app to a whole new level if net connection is possible,like checking on baby when you are out(you can click picture,upload it on cloud and then check it),using your other mobile to use as camera and many more examples ... we can always connect other mobile through wifi!
I am half dead atm(sleepy I mean) so can't really think much,but do give it a thought...
version 1.1.0
- New options for developers for not to store messages not sent if there is no connection in that moment.
By default, M2D Manager stores messages if there is no connection between devices in real time, if for your App the message is only valid in real time, set the following flag. For instance for an instant action.
intent.putExtra("flagNoStore",true) ;
Version 1.2.0 out!
Added feature to send and receive binary files. Don't send binary files greater than 500.000 bytes.
To send:
intent.putExtra("binary",byte[]) ;
To receive:
byte[] dataBinary = intent.getByteArrayExtra("binary");
If you need sending greater files, send them with several messages and concatenate them.
**
Version 1.2.1 out!
- Bug Fixed!
pacosal said:
Version 1.2.1 out!
- Bug Fixed!
Click to expand...
Click to collapse
?, When im watching a movie on my galaxy note 2 i dont receive notifications to my gear, will this (M2D) help with this issue?
rmont23 said:
?, When im watching a movie on my galaxy note 2 i dont receive notifications to my gear, will this (M2D) help with this issue?
Click to expand...
Click to collapse
I think so!
I have asked this question several times on XDA and had no luck, but this seems to be going the right way.
My main phone has to be connected to an external antenna when I am at home because the signal is so poor, I have a couple of spare phones that I want to be able to connect via Bluetooth to my main one, so that I can leave them in other rooms, and when a call comes in I want to be able to use either one as a `remote phone`, can you foresee this being possible? I would have thought, that if a GalaxyGear can remotely make/receive calls then surely a second Android phone can be utilised the same way?
Thanks
SSThing said:
I have asked this question several times on XDA and had no luck, but this seems to be going the right way.
My main phone has to be connected to an external antenna when I am at home because the signal is so poor, I have a couple of spare phones that I want to be able to connect via Bluetooth to my main one, so that I can leave them in other rooms, and when a call comes in I want to be able to use either one as a `remote phone`, can you foresee this being possible? I would have thought, that if a GalaxyGear can remotely make/receive calls then surely a second Android phone can be utilised the same way?
Thanks
Click to expand...
Click to collapse
Hi,
this would be perfect, but for calls it's not possible because Android framework don't have the required bluetooth profiles for this. I think Galaxy Gear has implemented this feature.
What we can get with this App and modules is to warn you when you receive a call in your main device and take it or not. To take it you will need a bluetooth hands free gadget.
Thanks
M2d Manger - Version 1.2.2 out!
- Bug fixed!
Working in several Apps in order to get these:
Could be used in both devices (main and auxiliary). Like a remote.
- Be able to camera preview and take pictures as well.
- Be able to record sounds
- Be able to control media player
Working in first option right now!
Very cool project. Do you plan to add a windows desktop client/receiver.
I've seen something like your app which sends notifications through internet, but Bluetooth would be very cool.
Also if we getting a call in second device, can it be transferred to primary device thro BT which is quite handy and usefull...!!...coz I've 2 sim card and 2 smartphones....!!
This is super awesome
Any plans to allow multicast?
So not just one slave, but many, that could daisy chain even?
Crazy idea in my head: Hook up a multitude of different devices, and have them all snap a picture at the same time
Hi,
in BOOTP / DHCP my default android device name appears as "android-327985af2a39fe75". I want to know the meaning of the number (after the "-").
It seems like some sort of unique ID but it doesn't match IMEI or MEID.
Thanks.
Hi,
Thanks for using XDA Assist Yes it is unique device ID for Wireless Connections
No Response hence Thread Closed ..