• Breaking News

    Thursday, February 13, 2020

    Android Dev - Simply add frames and titles to your Google Play screenshots.

    Android Dev - Simply add frames and titles to your Google Play screenshots.


    Simply add frames and titles to your Google Play screenshots.

    Posted: 13 Feb 2020 06:03 AM PST

    How do you test updating of third party libraries?

    Posted: 13 Feb 2020 12:10 AM PST

    Imagine that you have to update some third party libraries in your project. How will you check that nothing has been broken? Manual testing? Automated UI-tests? Maybe some other approach (like isolated tests for a certain library)?

    submitted by /u/aartikov
    [link] [comments]

    Is Google Play not indexing new apps AGAIN ?

    Posted: 13 Feb 2020 05:36 AM PST

    Like the last time, new apps are not getting indexed, and they won't appear in search result even if you search them by exact name.

    submitted by /u/MahlabaFire
    [link] [comments]

    Is dart or flutter free to use for developing mobile apps?

    Posted: 13 Feb 2020 07:22 AM PST

    Hello, I am willing to develop mobile app for a university project and want to use flutter. Are both of them free to use and will be enough for project? or do I have to buy them?

    submitted by /u/bilalarif2001
    [link] [comments]

    What are your essentials?

    Posted: 13 Feb 2020 07:54 AM PST

    Curious what the communities go-to/must-have frameworks or libraries are when developing.

    Http/Web Clients?

    Database?

    UI/Theming?

    Logging/Auditing?

    Other categories are welcome!

    submitted by /u/Just4Funsies95
    [link] [comments]

    For people using Appodeal, what does your "prominent disclosure" look like?

    Posted: 13 Feb 2020 04:07 AM PST

    My app was removed with this as the reason:

    Your app is using the Appodeal SDK, which is uploading user's phone number, social accounts and installed packages information without a prominent disclosure. Prior to the collection and transmission, it must prominently highlight how the user data will be used, describe the type of data being collected and have the user provide affirmative consent for such use.

    I handwrote a crappy privacy policy that def deserved to get taken down, so I'm curious what a good Appodeal disclosure looks like before trying to make a new one and potentially getting another strike. I understand there are generators out there but it would be great to see what one looks like that is actually in a live app that's acceptable by Google.

    Edit: also just read Appodeal recommends linking their privacy policy in yours, so that must be a part of it.

    submitted by /u/Liftdom_
    [link] [comments]

    Are interstitial ads on back button allowed?

    Posted: 13 Feb 2020 03:10 AM PST

    Is it allowed to use Admob's interstitial ads when Back Button is pressed on a specific activity? Can't find a recent legit answer.

    submitted by /u/laazaz
    [link] [comments]

    Using dagger in multi-module apps

    Posted: 12 Feb 2020 02:19 PM PST

    Listening specific node for updates

    Posted: 13 Feb 2020 08:44 AM PST

    Listening specific node for updates

    Hello all, i'm not a good programmer, i'm just trying to learn what is the best approach and keep learning.

    I've an app which lets users post pictures and other users can like it. I'm trying to listen these like events while online and offline. Offline part is another story i'll attach a service and childeventlistener for that.

    For the online part: I'm trying to show these like events on a fragment page called latest events.

    But for now my question is this; is my approach okay?

    I've created another Json structure for likes:

    This is structure.

    For getting userID's and Timestamps for the likes, i had to use GenericTypeIndicator and hashmap. My code is working, its showing notifications on the page, but in wrong order.

    valueEventListener = new ValueEventListener() { u/Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot ds: dataSnapshot.getChildren()){ LatestActivity c = new LatestActivity(); c.setPhotoId(ds.getKey()); //foto id GenericTypeIndicator<HashMap<String, Long>> genericTypeIndicator = new GenericTypeIndicator<HashMap<String, Long>>() {}; c.setUserTime(ds.getValue(genericTypeIndicator)); // Like id ve timestamp activities.add(c); adapter.notifyDataSetChanged(); } } 

    Then i pass my custom model to recyclerview adapter, there i do database calls to retrieve relevent things like picture link, date, users profilpicture etc.

    But this is also hard for getting key and value in HashMap. i have to know exact key to get the value(timestamp) to order the notifications by date.

    But i think this whole thing is a wrong approach, i can't think of a better way though.

    Do you folks suggest a better JSON structure or a better approach?

    Thanks.

    submitted by /u/cd1223g
    [link] [comments]

    Problem displaying Notification Progress Bar

    Posted: 13 Feb 2020 08:37 AM PST

    Hi, I have one service listening all time to detect shakes, once it detects shake records a video and then when recording service is over, I want to call another service to upload the video file to google drive.

    I'm having problems displaying a notification from service and also uploading the file. I keep getting same error, trying to invoke a method on a null reference.

    The thing is, my upload method is working, I tested it (not as service, just as methods on MainActivity), and It works. So what am I missing here? Does progress notification bar or uploading a file needs a view so they can't start?

    submitted by /u/chucklemuff
    [link] [comments]

    How to test Android Intent's Bundle using Mockk?

    Posted: 13 Feb 2020 04:21 AM PST

    I would like to test a custom handler class which is starting a new Activity. I would like to test the Intent's Bundle if contains the pre defined parameters.

    The test class:

    @MockK lateinit var activity: ActivityCalendar @Before fun setUp() { MockKAnnotations.init(this) } @Test fun testActivityBundles() { val book = mockk<Book>() every { book.releaseDate } returns GregorianCalendar().apply { this.timeInMillis = 1423825586000 } every { activity.startActivity(any()) } just Runs val handler = ActivityHandler(activity) handler.startRequiredActivity(book) verify { activity.startActivity( withArg { intent -> val bundle = intent.extras!! val releaseDateTimeMillis = bundle.getLong("release_date", 0L) Assert.assertEquals(1423825586000, releaseDateTimeMillis) } ) } } 

    The code above is crashing at line: val bundle = intent.extras!! but it shouldn't.

    The class that I want to test:

    class ActivityHandler(val activity: Activity) { fun startRequiredActivity(book: Book) { val intent = buildIntent(book) activity.startActivity(intent) } private fun buildIntent(book: Book): Intent { val extras = Bundle().apply { this.putLong("release_Date", book.releaseDate.timeInMillis) } return Intent(activity, ActivityBookDetails::class.java).apply { putExtras(extras) } } } data class Book( val releaseDate: GregorianCalendar ) 

    I debugged the code and I found out that function private fun buildIntent(book: Book): Intent is returning an "null" object (string "null" and not Java NULL).

    submitted by /u/leontin91
    [link] [comments]

    Android service not working when phone is idle / dozing / locked

    Posted: 13 Feb 2020 08:05 AM PST

    Good evening,

    I've been trying to achieve something for several days now and I literally don't know what else to try, I've basically tried everything I found online and it still doesn't work but I have the feeling that once I find the solution it must be something quite simple.

    I'm working on a bigger project, but here I'm just trying to get a very simple example to work which I can later adapt to my project.

    What I want to do

    I want to have a counter add +1 every second for 1200 seconds (20 minutes) and write to a file every time it counts. I should end up with a file with 1200 lines with a timestamp per sample.

    How I'm trying to do it

    I've tried a million things, but here, I've just gone back to a very basic example so I can showcase it and ask for help:

    - I have a MAIN acticity with a single START button.

    - When clicking the button I start a new process from the activity. This is a FOREGROUND process.

    - I start counting in a loop. When I reach 1200, the counting stops.

    My problem

    While the phone screen is ON everything works just fine, but as soon as I lock the screen and put my phone in my pocket, depending on the phone I'm testing on, it starts to fail.

    What I would like

    If someone could tell me what to modify / add / change or even do it for me and write back here (it's a really simple project) I would be extremely grateful, I'm wasting a ton of time and I just can't seem to hit the right key.

    Code

    Since it's a very simple project I will just copy the 4 parts it consists of right here:

    XML activity_main.xml

     <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <Button android:id="@+id/start_button" android:layout_width="150dp" android:layout_height="50dp" android:layout_marginStart="52dp" android:layout_marginBottom="116dp" android:onClick="startProcess" android:text="@string/button_label_start" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> <TextView android:id="@+id/counter_textView" android:layout_width="383dp" android:layout_height="412dp" android:gravity="center_horizontal|center_vertical" android:text="@string/counter_label_value" android:textSize="160sp" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.428" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.169" /> </androidx.constraintlayout.widget.ConstraintLayout> 

    MANIFEST AndroidManifest.xml

     <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloworld"> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <service android:name=".ForegroundService" android:enabled="true" android:exported="true" android:process=":externalProcess"> </service> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 

    MAIN MainActivity.java

     package com.example.helloworld; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { public static final String CHANNEL_ID = "ForegroundServiceChannel"; private TextView mShowCount; @Override protected void onActivityResult(int requestCode, int resultCode, u/Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); int mCount = data.getIntExtra(ForegroundService.FOREGROUND_MESSAGE, -1); if(mShowCount != null) mShowCount.setText(Integer.toString(mCount)); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mShowCount = findViewById(R.id.counter_textView); } @Override protected void onResume() { super.onResume(); } @Override protected void onStart() { super.onStart(); } @Override protected void onPause() { super.onPause(); } @Override protected void onStop() { super.onStop(); } @Override protected void onDestroy() { super.onDestroy(); } @Override protected void onRestart() { super.onRestart(); } public void startProcess(View view) { PendingIntent pendingResult = createPendingResult(100, new Intent(), 0); Intent serviceIntent = new Intent(this, ForegroundService.class); serviceIntent.putExtra("pendingIntent", pendingResult); ContextCompat.startForegroundService(this, serviceIntent); } public void stopProcess(View view) { Intent serviceIntent = new Intent(this, ForegroundService.class); stopService(serviceIntent); } } 

    FOREGROUND SERVICE ForegroundService.java

     package com.example.helloworld; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.os.Build; import android.os.IBinder; import android.os.SystemClock; import android.util.Log; import androidx.core.app.NotificationCompat; import java.io.File; import java.io.FileWriter; import java.util.Date; public class ForegroundService extends Service { public static final String CHANNEL_ID = "ForegroundServiceChannel"; public static final String FOREGROUND_MESSAGE = "com.example.helloworld.FOREGROUND_MESSAGE"; private PendingIntent data; private int mCount; private File basePath; public ForegroundService() { } @Override protected void finalize() throws Throwable { super.finalize(); } @Override public void onCreate() { super.onCreate(); } @Override public boolean stopService(Intent name) { return super.stopService(name); } @Override public int onStartCommand(Intent intent, int flags, int startId) { String input = intent.getStringExtra("inputExtra"); createNotificationChannel(); Intent notificationIntent = new Intent(this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); Notification notification = new NotificationCompat.Builder(this, MainActivity.CHANNEL_ID) .setContentTitle("Foreground Service") .setContentText(input) .setContentIntent(pendingIntent) .build(); startForeground(1, notification); data = intent.getParcelableExtra("pendingIntent"); this.basePath = this.getExternalFilesDir("recs"); mCount = 0; new Thread(new Runnable() { public void run() { try { while(mCount < 1200) { Intent resultIntent = new Intent(); resultIntent.putExtra(FOREGROUND_MESSAGE, ++mCount); writeFile((new Date().getTime() / 1000) + " Increasing counter: " + mCount + "\n"); data.send(ForegroundService.this, 200, resultIntent); SystemClock.sleep(1000); } }catch (Exception ignored){} } }).start(); //stopSelf(); return START_NOT_STICKY; } private void createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel serviceChannel = new NotificationChannel( CHANNEL_ID, "Foreground Service Channel", NotificationManager.IMPORTANCE_DEFAULT ); NotificationManager manager = getSystemService(NotificationManager.class); manager.createNotificationChannel(serviceChannel); } } @Override public void onDestroy(){ super.onDestroy(); } @Override public IBinder onBind(Intent intent) { return null; } private void writeFile(String data) { File file = new File (basePath,"test"); if (!file.exists()) { boolean mkdirs = file.mkdirs(); if (!mkdirs) { Log.e("RECORDING", "Error creating SAVE BASE PATH"); } } try{ File counter_file = new File(file, "counter.txt"); FileWriter writer = new FileWriter(counter_file, true); writer.append(data); writer.flush(); writer.close(); } catch (Exception e){ e.printStackTrace(); } } } 

    I know I might be asking a bit too much but I'm quite desperate at this point. I'd be really greatful if someone could come up with a working solution.

    Thank you very much.

    submitted by /u/CarlosBinary
    [link] [comments]

    Integrating PayPal with NativeScript (Android only)

    Posted: 13 Feb 2020 04:11 AM PST

    I'm just trying to get PayPal to work on Android right now. Many of the solutions online recommend using the PayPal sdk in the Gradle compile, but as far as I know the sdk has moved from the native to a CDN. Therefore, I'm stuck in a standoff.

    1. Implement PayPal with WebView and just had a bridge.
    2. Implement PayPal on the serverside since nodejs seems to have more support.
    3. Implement PayPal on Android, which is the most confusing at this point.

    Any help with this would be awesome and so would any resources to help me out.

    submitted by /u/sinithw
    [link] [comments]

    How do you share projects to GitHub without exposing the keys?

    Posted: 13 Feb 2020 07:34 AM PST

    I am running a Firebase Tutorials Blog but I lack some GitHub skills. I was just writing a tutorial where I will be demonstrating the use of Firebase Cloud Storage in Android. In the end, I will be sharing the code over Github but I don't want to share the google-services.json file and some other api keys.

    I am aware of gitignore but:

    a) I want to inform the users about the keys or files which are missing and they have to include them to run this code

    b) What will happen if I pull some previous commit on my machine, do I need to add those files/keys again myself too? Or the Android Studio will use the one which was not pushed because of gitignore

    Please help, thanks

    submitted by /u/davidkonal
    [link] [comments]

    Getting a Null value while passing data through intent to another activity

    Posted: 13 Feb 2020 07:25 AM PST

    When I do a debug, I can see the first activity sending thecorrect number, but the second activity always gets a null value. Thank you for helping.

    First Activity:

    val intent = Intent(this@InfBateria,ControlActivity::class.java) intent.putExtra(EXTRA_PERCENTAGE,batteryPercentage.toString()) 

    Second Activity:

    override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.control_layout) m_address = intent.getStringExtra(Connect.EXTRA_ADDRESS) val m_percentage: String? = intent.getStringExtra(InfBateria.EXTRA_PERCENTAGE) textView9.text = m_percentage 
    submitted by /u/tiagosilvaa8
    [link] [comments]

    Long press for minor shakes

    Posted: 12 Feb 2020 04:58 PM PST

    Getting old got a little bit of the shakes and when I try to do a long press sometimes I hold it to the icon but it interprets it as a short press or a click.

    Is there anything out there that will help me?

    TIA

    submitted by /u/JimMD00
    [link] [comments]

    Fragments overlapping

    Posted: 13 Feb 2020 05:10 AM PST

    Hello, I've been searching everywhere and the only solution I found was to add a background and clickable to true in the fragment...

    Any other tip ir solution besides that?

    submitted by /u/Mahjunia
    [link] [comments]

    How is important is UML in Android development?

    Posted: 12 Feb 2020 09:33 PM PST

    I've been learning about modeling and diagrams lately, but since I started programming, in general, I rarely come across class diagrams and things like that, I get that understanding what diagrams mean is important but is the UML standard even used in android programming (or any other field)?

    submitted by /u/paolovalerdi
    [link] [comments]

    Is Mapbox a good substitute for google map?

    Posted: 12 Feb 2020 04:40 PM PST

    I am working on a map-based app and for that, I have to use one API for the map so far I was using google map but for large no of request, its not free and one the free quota is over its pricy as compared to other API. I would love to know the opinion of other dev.

    submitted by /u/omega_savvy
    [link] [comments]

    First time making a simple card game, but which tool to use?

    Posted: 13 Feb 2020 02:12 AM PST

    Hey all,

    I would like to make a simple card game for Android. Right now I coded it in Java with Eclipse and only use the console for output. I've googled a bit on how to make an App for Android, but not sure which tool or tools to use. I've heard for games it's not really a good idea to use Android Studio. It's better to use Unity. Is that true? Even for simple 2D games?

    And if I use any of those tools, can I just use my classes I already make or do I have to rebuild?
    If there are other important things, let me know!

    Thanks in advance.

    submitted by /u/juunhoad
    [link] [comments]

    Sending live audio data to a PC

    Posted: 13 Feb 2020 02:06 AM PST

    Hi, I'm posting this because I'm unsure on how to proceed.

    I want to use Exoplayer and stream live audio data (recorded on the phone) to a PC.

    I am unsure about both the format of the data and the medium through which I can send it.

    Thank you in advance.

    submitted by /u/NotSoUncool
    [link] [comments]

    How do I host files for my android app? (free?)

    Posted: 13 Feb 2020 01:57 AM PST

    I'm pretty new to Android Developing, so bear with me :')

    I want to make an app that, among other things, can play (stream) audio files and download them to play even when you're offline, the same thing it needs to do for text and images. This app is intended for personal use.

    My first thought was to ditch streaming and just store the files locally, but then how do I add new content without recompiling the app every time?

    Where do I host the audio, image and text files for free, so that I can play and download them in the app? Can I host them myself?

    Will I need an SQL database too? Can I host that myself?

    submitted by /u/Jatoxo
    [link] [comments]

    How to integrate Firebase into your native C++ Android game.

    Posted: 12 Feb 2020 02:09 PM PST

    No comments:

    Post a Comment