intent

StartForeground for IntentService

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an IntentService and I want to make it sticky with an ongoing notification. The problem is that the notification appears and then disappears immediately. The service continues running. How should I use startForeground in an IntentService? @Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Notification notification = new Notification(R.drawable.marker, "Notification service is running", System.currentTimeMillis()); Intent notificationIntent = new Intent(this,

onActivityResult not call in the Fragment

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: The structure of the app is like this: tabHost ( in Activity ) -> contains -> TabFragment ( extend base container fragment ) 1 . The code in Activity : tabHost . addTab ( tabHost . newTabSpec ( "home" ). setIndicator ( "" , getResources (). getDrawable ( R . drawable . btn_home )), HomeFragment . class , null ); 2. The code in HomeFragment (Notice that HomeFragment is not the actual function but a container like this, and it extend BaseContainerFragment): public class HomeFragment extends BaseContainerFragment { public Home

Custom Account Type with Android AccountManager

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have an account type "mypackage.account" and a content authority "mypackage". I have a Service that provides an implementation of AbstractAccountAuthenticator , the addAccount method is implemented like this: /** * The user has requested to add a new account to the system. We return an intent that will launch our login * screen if the user has not logged in yet, otherwise our activity will just pass the user's credentials on to * the account manager. */ @Override public Bundle addAccount ( AccountAuthenticatorResponse response ,

Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Possible Duplicate: I'm getting a NullPointerException when I use ACTION_IMAGE_CAPTURE to take a picture I have some code. Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File photo = new File(CamDir, filename); imageUri = Uri.fromFile(photo); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); startActivityForResult(intent, 0); public void onActivityResult(int requestCode, int resultCode, Intent data) { Bitmap bitmap = null; if (resultCode == Activity.RESULT_OK && requestCode == 0) { Uri selectedImage = imageUri

Start Chrome as Web-App on Android start

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have a quite specific problem. I have realized a Web App on an Android tablet, which will be used on an exhibition (Outform iDisplay). For this reason, the Web App has to start directly after boot. The after-boot thing is no problem (Broadcast with "android.permission.RECEIVE_BOOT_COMPLETED"), but i have a problem to start Chrome as Web-App. For getting the Intent, i have read the Icons in the launcher favorites with this snippet: //Kitkat, therefore launcher3 url = "content://com.android.launcher3.settings/favorites?Notify=true";

Android requestLocationUpdates using PendingIntent with BroadcastReceiver

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I use requestLocationUpdates(long minTime, float minDistance, Criteria criteria, PendingIntent intent) In BroadcastReciver so that I can keep getting GPS coordinates. Do I have to create a separate class for the LocationListener ? Goal of my project is when I receive BOOT_COMPLETED to start getting GPS lats and longs periodically. Code I tried is : public class MobileViaNetReceiver extends BroadcastReceiver { LocationManager locmgr = null; String android_id; DbAdapter_GPS db; @Override public void onReceive(Context context, Intent

Custom scheme doesn't seem to launch in the app intent

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create an Android app that needs to use OAuth to authenticate (with the Google Wave data API) I've specified a custom scheme in my AndroidManifest.xml so that any views to a url beginning "braindump://" should go to my app: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.enigmagen.braindump" android:versionName="0.1" android:versionCode="1"> <uses-sdk android:minSdkVersion="7"></uses-sdk> <uses-permission android:name="android.permission.INTERNET"></uses

Invoking HP ePrint Android application

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working on an android app that should invoke android HP ePrint application for wireless printing. For that purpose, I'm using code: Intent intent = new Intent("com.hp.android.print.PRINT"); intent.setPackage("com.hp.android.print"); startActivityForResult(intent, 0); I am pretty sure that I didn't get intent's action right... Does anybody know what is the right action to invoke this HP ePrint application? And how can I pass the exact file to print (intent.putExtra(...)). Thanks 回答1: After more than 10 hours, I managed to find the

How can I sent multiple data types with Intent.ACTION_SEND_MULTIPLE when using a shareIntent?

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Its pretty clear in the documentation that you can send multiple pieces of data with: Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris); shareIntent.setType("image/*"); startActivity(Intent.createChooser(shareIntent, "Share images to..")); but it seems, from that one line: shareIntent.setType("image/*"); that all pieces have to be the same data type. What If I wanted to send a picture(image/jpeg) and a hashtag that should go along

onTaskRemoved of a Android Service is never being called ! Why?

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am stuck with a issue from last 2 days, I want to hit a api and show user a Toast when user swipe off the app from Background Task, I found that from service it is possible as onTaskRemoved is called when app is removed from background. Code : MyService.java public class MyService extends Service { private static final String TAG = MyService.class.getSimpleName(); Handler mHandler; @Override public void onCreate() { super.onCreate(); mHandler = new Handler(); } @Nullable @Override public IBinder onBind(Intent intent) { return null; }