Android hide

195 views

Published on

Android hint feeatures that no all developeres know, and probably they should.

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
195
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Android hide

  1. 1. Android developer ● Wordline ● Catmóbil SCP ● Catdroid @lepetitbernat http://es.linkedin.com/in/bernatp
  2. 2. Restricted profiles -> JellyBean+ Crash reports -> ApplicationErrorReport -> Send Feedback (2 ways) Hide intents -> Data usage
  3. 3. Added in JellyBean • Android 4.3 • API 18+ • Tablets
  4. 4. TYPE_BOOLEAN TYPE_CHOICE TYPE_MULTI_SELECT BroadcastReceiver IntentFilter android.intent.action. GET_RESTRICTION_ENTRIES
  5. 5. extends BroadCastReceiver { onReceive(...) PendingResult result = goAsync(); new Thread() run() // ADD RESTRICTIONS Create broadcast
  6. 6. new ArrayList<RestrictionEntry>(); new RestrictionEntry(KEY_BOOLEAN, true); entry.setTitle("Dangerous enabled"); entry.setType(RestrictionEntry.TYPE_BOOLEAN); add(entry); Create restrictions
  7. 7. Bundle extras = new Bundle(); extras.putParcelableArrayList( Intent.EXTRA_RESTRICTIONS_LIST, restrictions); result.setResult(Activity.RESULT_OK, null, extras); result.finish(); Final steps!
  8. 8. UserManager usrManager = (UserManager) getSystemService(Context.USER_SERVICE); Bundle restrictions = usrManager.getApplicationRestrictions(getPackageName()); restrictions != null restrictions.get(...); Using restrictions
  9. 9. Intent customIntent = new Intent(); customIntent.setClass(context, SettingsActivity.class); extras.putParcelable( Intent.EXTRA_RESTRICTIONS_INTENT, customIntent); result.setResult(Activity.RESULT_OK, null, extras); result.finish(); Custom restrictions
  10. 10. • d.android.com o http://goo.gl/I0D3PU • DevBytes o https://www.youtube.com/watch?v=pdUcANNm72o
  11. 11. Added in IceCream • Android 4.0 • API 14+ • Leave user write messages
  12. 12. ApplicationErrorRepor t • TYPE_NONE • TYPE_CRASH • TYPE_ANR • TYPE_BATTERY • TYPE_RUNNING_SERVICE
  13. 13. Exception e; ... report = new ApplicationErrorReport(); report.type = ApplicationErrorReport.TYPE_CRASH; ... crash= new ApplicationErrorReport.CrashInfo(); report.crashInfo = crash; ... arn = new ApplicationErrorReport.AnrInfo(); report.arnInfo = arn; … ApplicationErrorReport
  14. 14. Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("com.google.android.feedback", "com.google.android.feedback.FeedbackActivity"); intent.putExtra(Intent.EXTRA_BUG_REPORT, report) startActivity(intent); Intent
  15. 15. Intent.EXTRA_BUG_REPOR T Intent.ACTION_APP_ERRO R
  16. 16. Trick FeedbackException ● Custom message ● Custom class name ● Custom stacktrace ● User messages
  17. 17. • d.android.com o http://goo.gl/QZnjZW • Black feedback o http://stackoverflow.com/a/20848542 • Google feedback o http://stackoverflow.com/a/22156938
  18. 18. IntentFilter android.intent.action. MANAGE_NETWORK_USAGE ApplicationErrorReport
  19. 19. ?
  20. 20. !https://github.com/alorma/Baug_Android_hide

×