Generating unique id in J2ME - java-me

I want to generate universally unique id for registration process of my j2me application. i came across following approaches for that
IMEI no of device Getting IMEI and IMSI in Java ME this approach doesn't work on most of devices. Problem with IMEI is is not that easy to get it from Midlet for most of models.
Bluetooth device address Getting Bluetooth Address
Problem Needs support for Bluetooth API and will limit no of devices app can run on.
UUID class
Problem Need Bluetooth API as it is in javax.bluetooth package same prob
The registration process used by my company for their android app is as follows
customer mobile will send IMEI no and Token provided by company to server using SMS
Server will send licence key to customer mobile which will be stored in customer mobile
And i have to follow the same approach for j2me application
One solution can be getting unique id from server through SMS. but company uses above registration process.
Is there any other approch that i can use for registraing my application or is there any way to overcome above problems.

I agree with #funkybro that a Jad key with a unique ID provided by the server would solve the issue. But if its not possible I would create an id based on mobile time and a hash code.
long time = System.currentTimeMillis();
StringBuffer id = new StringBuffer(Long.toString(time, 16).toUpperCase());
id.append(Integer.toHexString(new Object().hashCode()).toUpperCase());
If this id is duplicated the registration process fails and the application is asked for a new id.

You can put a server generated unique ID in the jad at deploy time.

Related

Microsoft advertising ad units with UWP app - Windows 10

I've created 2 AdUnits in my Dev Dashboard. One for mobile and one for tablet/pc.
How am I suppose to handle these? I've read so many articles but I've yet to find out anything that tells you how to use both of these? Is that done automatically?
From what I've read and understood, when you upload your app to be approved, it will read the AdMediator.config and update it accordingly but if that's the case, I only have an AdUnit for Microsoft Advertising and one for AdDuplex but nothing that specifies whether it is for mobile or pc/tablets.
What am I missing?
Thanks.
Thierry
To handle AdUnits for Windows Mobile and Tablet/PC, you need to config your AdMediator.config file.
In AdMediator.config following keys are used for Tablet/PC Device family
WApplicationId - Tablet/PC Device family Application Id
<Key>WApplicationId</Key>
<Value>d25517cb-12d4-4699-8bdc-52040c712cab</Value>
WAdUnitId - Tablet/PC Device family AdUnit Id
<Key>WAdUnitId</Key>
<Value>10043121</Value>
And following keys are used for Mobile Device family
MApplicationId - Mobile Device family Application Id
<Key>MApplicationId</Key>
<Value>3f83fe91-d6be-434d-a0ae-7351c5a997f1</Value>
MAdUnitId - Mobile Device family AdUnit Id
<Key>MAdUnitId</Key>
<Value>10865270</Value>
Refer the screenshot for any confusion. Hope this is helpful to you.

Facebook AppRequests: Send request to users of iOS only

The latest Facebook iOS SDK (3.2) includes native methods for sending AppRequests to a user's friends via the FBWebDialogs class. Does it have any way to filter the recipients' list to friends that use iOS devices? Does Facebook keep any sort of database with these relationships?
Answering my own question - you can add 'devices' to the 'fields' parameter when querying the user's friends, create your own custom friend picker for app requests which parses users based on their devices, and send the list you build as a parameter to apprequests.

Getting Original Phone useragent with J2ME

Kinda new to J2ME. I was wondering how I could go about in getting a J2ME midlet to send the original user agent of the mobile device to a server instead of: "Profile/MIDP-1.0 Configuration/CLDC-1.0"?
The problem here is that I wont be able to kno the specific device the midlet runs on in order to manually set the useragent. This is because I'm developing a J2ME SDK that will be widely distributed for advertising purposes within other applications. It's like a plugin that fetches and display ads within an app.
For example, if the midlet runs on a sonyericsson, how can i get the midlet to send the original phone useragent:
"SonyEricssonW300i/R4EA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
to my server without actually using
"setRequestProperty(" User-Agent", "SonyEricssonW300i/R4EA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1")" ?
I want to detect the true device using WURFL on the server-side. If the midlet sends "Profile/MIDP-1.0 Configuration/CLDC-1.0" as the useragent, WURFL will detect the phone as "Generic J2ME midlet" instead of SonyEricsson W300.
I'd really appreciate it if someone assist.
The fool-proof way is to detect the user-agent when the web browser requests the jad, and set the value in the returned jad file.

Can you access sim contacts from J2ME?

Hi I am developing a mobile application where I need to access the phonebook of the users, SIM and phone contacts.
Is this possible?
Depends on the handset, some only let you access phone contacts, some do both phone and sim. Make sure you iterate over all the PIMLists supplied by PIM.listPIMLists(), often this method returns two lists, one of which will be phone, the other will be sim.
Yeah its possible. Look on this discussion on Nokia forum. Here it will be described clearly about how to get the contacts from phone and sim.
You can access the contacts using the following API
JSR 75: PDA Optional Packages for the J2METM Platform
http://www.jcp.org/en/jsr/detail?id=75
This is an optional package & maynot be there for all the mobile devices.
You can check the following URL for the sample programs
http://developers.sun.com/mobility/apis/articles/pim/index.html
http://www.java2s.com/Code/Java/J2ME/PersonalInformationManager.htm
Use the following code to check whether the device supports PIM or not :
String currentVersion = System.getProperty("microedition.pim.version" )
if the device is not supported then it will return null.

How to trigger an application in mobile automatically

My idea is to make an application start automatically when a message from a specific user reaches the inbox of the mobile . For example if my friend sends some numbers to my mobile, the sms has to be read and validated first and then calculator ( inbuilt mobile application) has to be triggered and process the numbers from the message. Please help me with the above query.
I am far from convinced you will be able to give the phone user access to the same sms you use to launch your MIDlet.
You may need to use native development on the phones that support it if J2ME can't give you exactly what you need.
In any case, you probably want to try with J2ME first so you need to read the specifications for JSR-118 and its PushRegistry API, along with JSR-120, which interfaces with SMS.
Most current J2ME-enabled phones will support static SMS Push but you will need to send the SMS to a particular port, much like you would data over a standard library socket.
I don't think you can trigger on just any old SMS message arriving.
This is the class you want to look at, in any case:
javax.microedition.io.PushRegistry

Resources