how to use google map with route in blackberry . i tried blackberry map with route but in my device (Storm 2) cant display map . i dont know what is the issue ?
any one have idea ragarding google map in blackberry application than let me know.
i tried this http://maps.google.com/maps?saddr=23.4444,72.44445&daddr=23.55555,72.55555
and open this url in BB browser but it cant redirect to map site .
how can we handle google map or blackberry map with route in BB application ?
i have implemented Google Map with route in Blackberry via Google Map Installed App.
public void invokeGoogleMap() {
int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
if (mh == 0)
{
try
{
throw new ApplicationManagerException("GoogleMaps isn't installed");
}
catch (ApplicationManagerException e)
{
System.out.println(e.getMessage());
}
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
stubDialog.inform("GoogleMaps isn't installed on your device.download it from m.google.com/maps.");
}
});
}
else
{
URLEncodedPostData uepd = new URLEncodedPostData(null, false);
uepd.append("action", "ROUT"); // or LOCN
uepd.append("start", "23.039568,72.566005");
uepd.append("end", "23.02,73.07");
String[] args = { "http://gmm/x?" + uepd.toString() };
ApplicationDescriptor ad = CodeModuleManager.getApplicationDescriptors(mh)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
try
{
ApplicationManager.getApplicationManager().runApplication(ad2, true);
}
catch (ApplicationManagerException e)
{
System.out.println(e.getMessage());
}
}
}
Blackberry browser is not fully functional for java script to display route info in browser field.Instead you have to use Blackberry maps. for this the following link will help you.
How to find the route between two places in BlackBerry?
Related
I am trying to simulate a phone call using Android's TextToSpeech services. I am trying to direct the speech to come out of the top speaker at your ear. This is done within a socket.io listener.
I have confirmed the AudioManager.STREAM_VOICE_CALL is using the Call output stream on my phone (Essential Phone), but it does not come out of the ear piece.
Does anyone have any suggestions? I don't have another device to test it on at the moment. Is that likely the issue?
private Emitter.Listener onEmergencyType = new Emitter.Listener() {
#Override
public void call(final Object... args) {
runOnUiThread(new Runnable() {
#Override
public void run() {
String emergType = args[0].toString();
HashMap<String, String> myHashCall = new HashMap<String, String>();
myHashCall.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_VOICE_CALL));
t1.speak(emergType, TextToSpeech.QUEUE_FLUSH, myHashCall);
if(!t1.isSpeaking()) {
try {
GetAudio("emergencyType", emergType);
} catch (Exception e) {
Log.e("PhoneCallActivity", "unexpected " + e.getMessage());
}
}
}
});
}
};
To route audio to the top speaker use AudioManager's method setSpeakerphoneOn. Set it to false to route sound to the top speaker, true -> to the bottom (loudspeaker)
AudioManager audioManager = (AudioManager) context.getSystemService(AUDIO_SERVICE);
audioManager.setSpeakerphoneOn(false);
Also, you will need extra permission in AndroidManifest
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Talking about earpiece - if it's wireless (Bluetooth) headset - you should also utilize setBluetoothScoOn(true)/setBluetoothScoOn(false) and startBluetoothSco()/stopBluetoothScon()
I'm trying to create a playlist viewer and I got stuck on paging.
I want to get all the names of current users playlists.
Any help would be appreciated.
public void getPlaylists() {
try {
SpotifyApi spotifyApi = new SpotifyApi.Builder().setAccessToken(auth.getToken()).build();
GetListOfCurrentUsersPlaylistsRequest getListOfCurrentUsersPlaylistsRequest = spotifyApi.getListOfCurrentUsersPlaylists().limit(5).offset(0).build();
Paging<PlaylistSimplified> playlistSimplifiedPaging = getListOfCurrentUsersPlaylistsRequest.execute();
} catch (IOException | SpotifyWebApiException e) {
System.out.println("Erroras: " + e.getMessage());
}
}
Okey so found out the answer myself don't know if its the correct way but it will work.
You can convert the paging object to a list :
List<PlaylistSimplified> playlists = Arrays.asList(playlistSimplifiedPaging.getItems());
And then get the info about your object normally.
I am trying to retrieve from a Azure Mobile service to the android application, I have been using Mobile Service client to do so. Here is my code.
try {
mClient = new MobileServiceClient(
"URL", "Key",
this);
ListenableFuture<MyObject> result = mClient.invokeApi("CCOOutageHistoryData", "GET", null, MyObject.class);
Futures.addCallback(result, new FutureCallback<MyObject>() {
#Override
public void onFailure(Throwable exc) {
//createAndShowDialog((Exception) exc, "Error");
}
#Override
public void onSuccess(MyObject result) {
String Incdenti= result.getCount();
//createAndShowDialog(result.getCount() + " item(s) marked as complete.", "Completed Items");
//refreshItemsFromTable();
}
});
However, I don't get any error but , when checking using a breakpoint it does not reach the onSuccess or Onfailure methods within Future.addcallback.
I am trying to retrieve the JSON data after invoking the azure mobile service api . Please help
Try with String[]
try {
mClient = new MobileServiceClient(
"URL", "Key",
this);
ListenableFuture<String[]> result = mClient.invokeApi("CCOOutageHistoryData", "GET", null, (new String[0]).getClass());
Futures.addCallback(result, new FutureCallback<String[]>() {
#Override
public void onFailure(Throwable exc) {
//createAndShowDialog((Exception) exc, "Error");
}
#Override
public void onSuccess(String[] result) {
}
});
There are some samples below that may help you learning the Coutom API for Android with the .NET backend of mobile service.
A test sample for the Custom API in Android, please see https://github.com/Azure/azure-mobile-apps-android-client/blob/master/e2etest/src/main/java/com/microsoft/windowsazure/mobileservices/zumoe2etestapp/tests/CustomApiTests.java
The sample for the .NET backend of mobile service, please see https://github.com/Azure-Samples/app-service-mobile-dotnet-backend-quickstart.
Hope it helps. Best Regards。
Is it possible to change default sms application on Android 4.4 without user knowledge? I'm trying to do it on a ROOTED Galaxy S5 using reflection and invoking system methods, so here is what I done so far:
Created small app that implements all things needed for app to be a SMS manager (as per http://android-developers.blogspot.in/2013/10/getting-your-sms-apps-ready-for-kitkat.html) and I can make it default sms app but Android asks me to confirm that in dialog. Now I'm exploring android source code and I found something in this class:
https://github.com/android/platform_packages_apps_settings/blob/2abbacb7d46657e5863eb2ef0035521ffc41a0a8/src/com/android/settings/SmsDefaultDialog.java
So I'm trying to invoke internal method:
SmsApplication.setDefaultApplication(mNewSmsApplicationData.mPackageName, this);
via reflection and here is how I done it so far:
Class[] params = new Class[2];
params[0]=String.class;
params[1]=Context.class;
Class cls = null;
try {
cls = Class.forName("com.android.internal.telephony.SmsApplication");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Method method = null;
try {
method = cls.getDeclaredMethod("getSmsApplicationData", params);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
try {
Object[] params2 = new Object[2];
params2[0]=getPackageName();
params2[1]=getApplicationContext();
Log.d("Current package", getPackageName());
method.invoke(null, params2);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
And I made this app system app and put it into folder /system/priv-app, rebooted phone and started it successfully with adb, but when I click on the button that executes code above, nothing happens. No errors, no log output, but default app is still Messaging (com.android.mms).
Is there any way to do this?
This information contained in file /data/system/users/0/settings_secure.xml. For example, default application for SMS stored by key sms_default_application.
<setting id="85" name="sms_default_application" value="com.google.android.talk" package="com.android.settings" />
More info you can find in this class: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/provider/Settings.java#6067
Accordingly, if you have ROOT permissions, you can edit this file.
for some time I am trying to open file godatabase on android using ESRI api in version 10.2.
I have a file godatabase made with Arccatalog 10.1. It contains one layer. I can open it in Arcmap so everything looks fine here.
The geodatabase is in folder named android.gdb
I copied it to microSD card and tried to open it using this code:
new com.esri.core.gdb.Geodatabase("/mnt/sdcard2/android.gdb");
The "/mnt/sdcard2/android.gdb" file exists and is a folder and I have read and write permissions.
I get a RuntimeException with the message that the goedatabase file could not be opened.
Anyone had similiar issues with that ?
The ESRI runtime api for android wont be able to open that kind of database. It uses a proprietary version of a geodatabase built in SQLLite. You will need to publish a service in ArcGisOnline or ArcServer 10.2 and call the GeodatabaseSyncTask object in order to get a version of your database in the right format onto the device. On your published feature service you will need to make sure Sync is enabled. Then you can utilize this code to call your feature service and store it locally. This code is based on this ESRI sample -- https://developers.arcgis.com/android/sample-code/offline-editor/
public void LoadGdb(UserCredentials credentials, Polygon extent, SpatialReference spatRef){
mapExtent = extent;
mapSpatialRef = spatRef;
String replicaUrl = callingActivity.getResources().getString(R.string.feature_service_url);
gdbTask = new GeodatabaseSyncTask(replicaUrl, credentials);
gdbTask.fetchFeatureServiceInfo(new CallbackListener<FeatureServiceInfo>() {
#Override
public void onError(Throwable e) {
Log.e(TAG, "", e);
}
#Override
public void onCallback(FeatureServiceInfo objs) {
if (objs.isSyncEnabled()) {
requestGdbInOneMethod(gdbTask, mapExtent, mapSpatialRef);
}
}
});
}
protected void requestGdbInOneMethod(GeodatabaseSyncTask geodatabaseSyncTask, Polygon extent, SpatialReference spatRef) {
GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters({0, 1}, extent,
spatRef, true, SyncModel.LAYER, spatRef);
CallbackListener<String> gdbResponseCallback = new CallbackListener<String>() {
#Override
public void onCallback(String obj) {
try {
// This onCallback gets called after the generateGeodatabase
// function on the GeodatabaseSyncTask is called.
// You can store a reference to this database or you can load it
// with your code and point it to the gdbFileName location
Geodatabase myGeodatabase = (Geodatabase)obj;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
#Override
public void onError(Throwable e) {
Log.e(TAG, "", e);
}
};
GeodatabaseStatusCallback statusCallback = new GeodatabaseStatusCallback() {
#Override
public void statusUpdated(GeodatabaseStatusInfo status) {
showMessage(callingActivity, status.getStatus().toString());
}
};
// !! THE gdbFileName is a string of the path and filename
// where the geodatabse will be stored.
geodatabaseSyncTask.generateGeodatabase(params, gdbFileName, false, statusCallback, gdbResponseCallback);
}
To load a local file you need to use ArcGIS Desktop 10.2.1 or higher to generate a Runtime Geodatabase file with a *.geodatabase file extension. See the instructions here: http://resources.arcgis.com/en/help/main/10.2/index.html#//00660000045q000000