i tried out its not working anyone can help me out
public void googlefunc(View v)
{
try {
AddThis.shareItem(this, "googleplus", mUrl, mShareTitle,
mShareDescription);
}
catch (ATDatabaseException e) {
e.printStackTrace();
}
catch (ATSharerException e) {
e.printStackTrace();
}
}
You have to use google_plusone (or google_plusone_share) instead of googleplus.
See the list of the available service (and search for google_plusone to find the right row).
Related
Hello I'm working with google map android api and I'm using google maps android geojson utility. I'm adding 3 layers of geojson into the map only the road_layer(LineString) have feature click event. The click event is working fine until I'm adding the samsad_boundary_layer(Polygon). The issue is if the samsad_boundary_layer feature is clicked it's triggering the road_layer feature click event although the layer(samsad_boundary_layer) have no feature click event.
private void showBoundery(){
try {
samsad_boundary_layer=new GeoJsonLayer(mMap,R.raw.samsad_boundary,MapActivity.this); //1st Layer
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
samsad_boundary_layer.getDefaultPolygonStyle().setZIndex(-12f);
GeoJsonPolygonStyle polygonStyle=samsad_boundary_layer.getDefaultPolygonStyle();
polygonStyle.setStrokeWidth(5f);
polygonStyle.setStrokeColor(getResources().getColor(R.color.purple));
samsad_boundary_layer.addLayerToMap();
}
private void retrieveFileFromResource() {
try {
temp_layer=new GeoJsonLayer(mMap,R.raw.area_survey,this); //2nd Layer
temp_layer.addLayerToMap();
road_layer=new GeoJsonLayer(mMap,R.raw.road_survey,this); //3rd Layer
road_layer.setOnFeatureClickListener(new Layer.OnFeatureClickListener() {
#Override
public void onFeatureClick(Feature feature) {
if (feature!=null){
Iterator<HashMap> flavoursIter = feature.getProperties().iterator();
while (flavoursIter.hasNext()){
Map.Entry entry = (Map.Entry)flavoursIter.next();
//Log.v("SURVEYOR_FEATURE",entry.getKey().toString()+":"+entry.getValue());
}
}
}
});
GeoJsonLineStringStyle lineStyle=road_layer.getDefaultLineStringStyle();
lineStyle.setZIndex(10f);
lineStyle.setWidth(2f);
lineStyle.setColor(getResources().getColor(R.color.light_green));
road_layer.addLayerToMap();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
Instead of adding 3 layers on map separately, traverse through all and create single layer.
Then add layer to map and set feature click listener. Handle onFeatureClick accordingly.
Testing presence of videeditor_jni Native Library in system libraries by
static {
try {
if (System.getProperty("videoeditor_jni") != null) {
System.loadLibrary("videoeditor_jni");
} else {
PreferenceManager.setLibraryFlag(false);
}
} catch (Exception e) {
PreferenceManager.setLibraryFlag(false);
}
}
while running this code i've got UnsatisfiedException on library in logcat.
though I've put conditions and try..catch it is checking if condition and then Force Close. why didn't go into catch?? any reason? tried UnsatisfiedException, RuntimeException, Exception, Error but not anything called in catch.. need help .
To Catch exception stackTrace use method printStackTrace(). like as belows
write this Application class onCreate method.
public void onCreate()
{
super.onCreate();
....
try {
if (System.getProperty("videoeditor_jni") != null) {
System.loadLibrary("videoeditor_jni");
} else {
PreferenceManager.setLibraryFlag(false);
}
} catch (Exception e) {
e.printStackTrace.
}
}
Let's say I need to add some Exception subclasses into catch, such as these ones
...//
catch (ConnectTimeoutException e) {
e.printStackTrace();
} catch (HttpHostConnectException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
The first two are (obviously) subclasses of IOException.
How can I add such subclasses into catch in a better (quicker, easier) way than copy/pasting then?
I am confident that IDEA has such automatic feature, but I am not sure which one it is or how to use it.
Alt+Enter on try, Detail exceptions:
Up to Android 2.2 I know I can use reflection and terminate the call through getITelephony.
However, as of 2.3 this no longer works because even if you grant the MODIFY_PHONE_STATE permission to your app, it's now a system app only permission:
https://stackoverflow.com/a/5095956/821423
That said, it's possible still because a myriad of applications on the google play market are doing it just fine on ICS, for example, this one:
https://play.google.com/store/apps/details?id=com.androminigsm.fscifree&hl=en
So the question is, how do they do it? I know I can pick up the call using simulating a headset hook, but I can't figure out how to end the call.
Thank you.
Well after much soul-searching I realize something really, really, really dumb. On the plus side no one on StackOverflow seems to have noticed it either. MODIFY_PHONE_STATE is no longer working on silenceRinger() since 2.3+, but endCall is just fine.
So the solution is to comment out the call to silenceRinger().
Can't believe I've just spent a week on this! I'll try to update the other questions as there seem to be tons of dupe on SO along the lines of 'it's not possible to use reflection to terminate the calls anymore'.
The call() , endcall() functions work fine for me as well. But there is also another way tha works without using iTelephony.aidl. Its published in this post. BTW I think google already knows but for some reason they havent done anything with the rest of functions, wich is good!!!
http://androidbridge.blogspot.com/2011/05/how-to-answer-incoming-call-in-android.html
private void endCall(final String cutofftime) {
TelephonyManager telephony = (TelephonyManager) srvs
.getSystemService(Context.TELEPHONY_SERVICE);
Class c;
final com.android.internal.telephony.ITelephony telephonyService;
try {
c = Class.forName("android.telephony.TelephonyManager");//telephony.getClass().getName());
Log.i("TelephonyClass Name", telephony.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
telephonyService = (ITelephony) m.invoke(telephony);
TimerTask task = new TimerTask() {
#Override
public void run() {
try {
if (telephonyService.isIdle()
|| telephonyService.isOffhook()
|| telephonyService.isRinging())
telephonyService.endCall();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
long delay = Integer.parseInt(cutofftime) * 1000;
new Timer().schedule(task, delay);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I have successfully setup the Facebook Plugin by Jos located (https://github.com/jos3000/phonegap-plugins/tree/master/Android/Facebook) - but I can't seem to figure out a way to log the user out. Sure I could tell them to delete the App access on the website then try to login again and click on "Not you?" but I would really rather have a JS Function that does it for me.
Can anyone help provide some guidance on how to do this? I've looked through the files and it looks like there is a way to do it in the facebook.java but I just need to hack something together to connect it to webview. I'm not capable of doing so :) can anyone please help?
This solution is to disable the single sign on feature in the Facebook plugin
in FaceBook.java file
replace DEFAULT_AUTH_ACTIVITY_CODE in the Authorize method [2 overloads] by FORCE_DIALOG_AUTH
in FacebookAuth.Java file
append this to execute method [in the switch case section]
else if (action.equals("performLogout")){
this.performLogout(first);}
//Add this method to FacebookAuth.java class
public void performLogout(final String appid) {
Log.d("PhoneGapLog", "LOGOUT");
final FacebookAuth fba = this;
Runnable runnable = new Runnable() {
public void run() {
fba.mFb = new Facebook(appid);
fba.mFb.setPlugin(fba);
try {
fba.mFb.logout((Activity) fba.ctx);
fba.success(new PluginResult(PluginResult.Status.OK, ""), fba.callback);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
};
};
this.ctx.runOnUiThread(runnable);
}
//in facebook.js file add the following section
Facebook.prototype.Logout = function(app_id,callback){
PhoneGap.exec(callback,null, "FacebookAuth", "performLogout", [app_id]); };
// in your page add the following code
function LogoutClick() //on logout click
{
appId = "123" ; //your app Id
window.plugins.facebook.Logout(appId,CompleteLogout);
}
function CompleteLogout() //call back function
{
//do some logic for callback
}
//Enjoy..!!