Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
smiling giraffe
Nov 12, 2015

Shadow0 posted:

I'm keeping track of my expenses with my app, and I want to be able to copy the database as a backup. But I also want the option to import a database for the opposite reason. Being able to do it for a particular month or other grouping would also be nice.
I suppose I could just export/import it as a CSV file or something.

I was wondering if you could do what you wanted with some meta-data fields, like adding a import_id field to each table, and another table to keep track of which import is current, etc. This you could do in Room, but I can see it getting really annoying if your table schema is anything beyond basic, and it will add overheard to future changes.

To do what you originally asked though, I think you're going to want to use, https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase

Adbot
ADBOT LOVES YOU

Shadow0
Jun 16, 2008


If to live in this style is to be eccentric, it must be confessed that there is something good in eccentricity.

Grimey Drawer

smiling giraffe posted:

I was wondering if you could do what you wanted with some meta-data fields, like adding a import_id field to each table, and another table to keep track of which import is current, etc. This you could do in Room, but I can see it getting really annoying if your table schema is anything beyond basic, and it will add overheard to future changes.

To do what you originally asked though, I think you're going to want to use, https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase

I shouldn't need to be adding any more fields. I just want to copy the .db to another folder, though maybe with some cropping options. For importing, I'm just having the options: clobber conflicting primary keys (with new or old) or generate new ones.
I'll take a look at the link though, thanks!

GeorgieMordor
Jan 23, 2015
New to Android dev -- and Java, really. Working on a project now with my team and having issues with the Chrome tools to inspect a WebView running on an Android application.

It 404s when trying to hit chrome://inspect#devices in Chrome. Device shows up along with the page in the WebView, but 404s when trying to "inspect". Looking this up its a known issue -- Chrome seems to be flip flopping with this feature and breaking it every other release.

Does anyone have advice for a good workaround for debugging in a WebView?

Basically we have some JavaScript on a page that isn't working correctly and I am unsure how to get some debug info as to what's going wrong.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Is it possible for you to use the regular mobile chrome browser for this site? Desktop chrome integrates with mobile chrome via some sort of alchemy iirc.

GeorgieMordor
Jan 23, 2015

Volmarias posted:

Is it possible for you to use the regular mobile chrome browser for this site? Desktop chrome integrates with mobile chrome via some sort of alchemy iirc.

I wish! But alas, no. The application of this App is as a kiosk-style interaction -- none of the other apps on the software or software will be accessible, so we're confined to keeping this page interaction inside the WebView.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

GeorgieMordor posted:

I wish! But alas, no. The application of this App is as a kiosk-style interaction -- none of the other apps on the software or software will be accessible, so we're confined to keeping this page interaction inside the WebView.

What I mean is, do you have any special native functionality hooked up to your webview? If not, can you use mobile chrome (or desktop chrome emulating a native webview!) for development so that you can debug it?

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

Hello! I am creating a react-native app which needs to hide sensitive content when switching apps.

On ios you can customize the screen to show when switching.
But it seems like the only thing I can do on android is enable FLAG_SECURE, which does exactly what I want, except it doesn't allow me customizing the screen when switching.

However I have seen some apps on my phone that are able to display a custom screen.

What I tried to do was this

code:
  @Override
    protected void onPause() {
        ContentFrameLayout parentView = findViewById(android.R.id.content);
        View view = getLayoutInflater().inflate(R.layout.launch_screen, null);
        parentView.addView(view, parentView.getWidth(), parentView.getHeight());
        view.bringToFront();
        super.onPause();
    }

    @Override
    protected void onResume() {
        ContentFrameLayout parentView = findViewById(android.R.id.content);
        parentView.removeView(findViewById(R.id.launch_screen));
        super.onResume();
    }
The problem I have is that it only works some of the times. It seems like it's working every time on my first screen, but as soon as I get to my main tab-bar it seems to work like 50% of the time.

Of course the customer is pointing to other applications which pulls this off, but I seem to be unable.
If I do it this way there is also the fact that I need to disable screenshots somehow.

Has anyone done this sucessfully? Any example?

Also, I am using https://github.com/wix/react-native-navigation for navigation.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Sorry, I'm not quite clear on what you mean. Do you mean that when the user navigates away from the app, the currently drawn screen changes?

Can you point to some examples of apps that do this?

FAT32 SHAMER
Aug 16, 2012



Volmarias posted:

Sorry, I'm not quite clear on what you mean. Do you mean that when the user navigates away from the app, the currently drawn screen changes?

Can you point to some examples of apps that do this?



Except pretend this is android not ios

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

I guess you want to put up some kind of banner image that says something like NUH UH (or something more professional) so that's visible when people task switch or try to screenshot?

There's an answer that goes into a bit of detail about it here
https://stackoverflow.com/a/49340273

but unfortunately it doesn't look reliable - the system takes a screenshot at some point, and it's not guaranteed to be after onPause is called. You could probably improve your chances by inflating that view and just keeping it hidden until you need to display it (since the layout won't happen immediately when you inflate and add the view), but it still doesn't look guaranteed, and it might be something that seems to work on one device but not on another

also I think the only way to prevent screenshots is FLAG_SECURE, so you'd have to do a thing where you set that in onResume and disable it in onPause (so it allows a thumbnail) but again the thumbnail screenshot might be attempted before onPause is called. Although in that case at least the failure would mean a black thumbnail rather than an unobscured one. I guess setting your view to visible before unsetting the secure flag would give you your best shot?

but yeah, I think making the view display as fast as possible might be your best bet. Have it already inflated and added to the layout - maybe test if it's quicker to have the main content in another container (on top of your banner) and set that container as invisible so it reveals what's behind it, rather than moving your view to the top of the hierarchy. Might be a faster operation (or it might be a lot slower I haven't looked into it!)

smiling giraffe
Nov 12, 2015

Sistergodiva posted:

...a problem...

baka kaba posted:

...a possible solution...

Did you try this? Did it work?

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

smiling giraffe posted:

Did you try this? Did it work?

I got it to add the view on top about 95% of times on my start-screen.

The problem I think is that react-native-navigation actually uses androids navigation instead of doing it all in javascript.

At least what happens is that it only hid the screen with the new view before the thumbnail was taken about 10% of times.

I know too little about android intents/activities/views to be able to experiment more with how I can try other ways.

melon cat
Jan 21, 2010

Nap Ghost
Android dev job question. I'm a video production guy with some coding aptitude (I've done VBA programming and website development). I came across this local job posting for an Android Multimedia Developer. I'm really intrigued by it and didn't even know that this type of field exists in Android Development. But I'm also brand new to Android development. What would be the best way for me to start training up for this kind of career? Just go through the 'Learning Android' recommendations in the OP while exploring the Android Multimedia Framework?

It sounds really interesting and also sounds as if it'd combine my video production expertise with my (admittedly light) coding capabilities and interest in cars. Just not sure where the best place to start is, especially given that I don't have a Comp Sci background/degree.

melon cat fucked around with this message at 00:52 on Aug 15, 2019

FAT32 SHAMER
Aug 16, 2012



melon cat posted:

Android dev job question. I'm a video production guy with some coding aptitude (I've done VBA programming and website development). I came across this local job posting for an Android Multimedia Developer. I'm really intrigued by it and didn't even know that this type of field exists in Android Development. But I'm also brand new to Android development. What would be the best way for me to start training up for this kind of career? Just go through the 'Learning Android' recommendations in the OP?

It sounds really interesting and also sounds as if it'd combine my video production expertise with my (admittedly light) coding capabilities and interest in cars. Just not sure where the best place to start is, especially given that I don't have a Comp Sci background/degree.

I’ve actually done android infotainment work before. The name of that title is a misnomer and all you would be doing is working on apps like the radio or Spotify apps to do things. Additionally you will probably deal with a lot of C/C++ code interfacing with Android code

I should also note that unless something has changed in the last few years, GM uses React Native for Android

PokeJoe
Aug 24, 2004

hail cgatan


melon cat posted:

Android dev job question. I'm a video production guy with some coding aptitude (I've done VBA programming and website development). I came across this local job posting for an Android Multimedia Developer. I'm really intrigued by it and didn't even know that this type of field exists in Android Development. But I'm also brand new to Android development. What would be the best way for me to start training up for this kind of career? Just go through the 'Learning Android' recommendations in the OP while exploring the Android Multimedia Framework?

It sounds really interesting and also sounds as if it'd combine my video production expertise with my (admittedly light) coding capabilities and interest in cars. Just not sure where the best place to start is, especially given that I don't have a Comp Sci background/degree.

I believe FAT32 SHAMER (few posts up) actually works in this exact specialty but id imagine it's relatively similar to routine android dev if you're working on the car's entertainment system.

FAT32 SHAMER
Aug 16, 2012



PokeJoe posted:

I believe FAT32 SHAMER (few posts up) actually works in this exact specialty but id imagine it's relatively similar to routine android dev if you're working on the car's entertainment system.

:3:

Oh the other thing I forgot to mention is at least in Detroit, GM is really strict about only hiring people who have their BS in CS or related degree

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Rookie question. I'm looking at building a simple app that runs a timer based on the Omaha Steak grilling guide. Building it purely for fun and learning, and thinking about trying out Flutter for it.

My question is if I build it, is it easy to share the app with friends/family without going through a publishing process? Can I just send the apk to my friend and they can install without issue?

kitten smoothie
Dec 29, 2001

Yeah, follow the directions in the docs to make a release signed version but don't post it to the store. You can just pass the .apk file to your friend and they can enable "install apps from unknown sources" on their phone and install it.

PokeJoe
Aug 24, 2004

hail cgatan


Yeah you can email the APK to them and they can install it directly from their email client on their phone. Very useful

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Awesome. Thanks!

FAT32 SHAMER
Aug 16, 2012



crossposting from cjs but i thought you would all enjoy this

FAT32 SHAMER posted:

cjs: we couldnt figure out why a mapview in a dialog refused to update the current location of a vehicle and then i realised something: it was a feature added right before a release was due

so i go to the layout xml and find that our lil mapview is actually an imageview with a picture of our HQ on google maps inside

lol

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

technically accurate!

it worked too huh

FAT32 SHAMER
Aug 16, 2012



baka kaba posted:

technically accurate!

it worked too huh

It passed off as fine for a year since the test fleet used to be at a different location lol

Splinter
Jul 4, 2003
Cowabunga!
Are there any potential pitfalls of using UUID Strings as primary keys in an Android app DB (that does have relational data, i.e. there will be joins via these UUIDs)? I know sqlite isn't as optimized as say Postgres (which has its own UUID type) for handling UUIDs, but I'm thinking that's not a huge deal if I'm not expecting users to have more than hundreds of records in the extreme case. I've seen UUIDs used as PKs in some of Google's Room samples, so it doesn't seem like it would be the worst idea.

One thing I've run into already is the lack of obvious guaranteed unique integer that can be used as a notification ID to tie a notification to a specific record, but String.hashCode() (or something similar) should work well enough for this (despite the chance of collisions).

Just wanna make sure I'm not digging myself into too big of a hole going this route. It does simplify a lot of other code (especially interaction with the API server).

brand engager
Mar 23, 2011

Why bother manually assigning primaries, doesn't every db have an autoincrement for that

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

SQLite has auto increment row keys but I believe these are generated per table. It sounds like OP might be having an issue where they are spawning notifications and need something more unique than "oh this came from row 35" when the user taps on the notification to launch the app?

brand engager
Mar 23, 2011

if you can't depend on the row number or whatever you could embed something unique to that data into the pendingIntent for the notification using Extras

KillHour
Oct 28, 2007


A key is arbitrary, as long as it's unique. There's no reason you can't use any guaranteed-unique value you want.

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Some classes in the Android standard library (e.g. CursorAdapter) always require inclusion of the standard SQLite "_id" row, but I don't know if that would ever matter in the case of tables also having an indexed UUID column.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
I don't believe there's any Android specific issues with using UUIDs for databases or anything else, but it might help if you give us more information about why you would prefer to use UUIDs instead of an auto incrementing PK.

Splinter
Jul 4, 2003
Cowabunga!

brand engager posted:

Why bother manually assigning primaries, doesn't every db have an autoincrement for that

My clients are responsible for generating an ID that will be unique on the back end. Using UUID for this. I don't need to use this as the PK on the client, but it simplifies a lot of the code to do things that way (e.g. don't need to map UUIDs of record and relations to internal int PK whenever receiving data from the server).

Notifications aren't a primary driver for this, just an example I noticed where an int PK could come in handy.

That CursorAdapter thing is something I'll need to look into, as if it does require an int ID that is the sort of thing I was thinking of that may cause issues form the road.

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

one potential pitfall i can think of, for generating UUIDs on client devices locally, is that proper random number generation is an area that a lot of hardware and software makers tend to screw up. it sounds like it wouldn't be the most critical failure in your case, compared to e.g. implementing cryptography, but with the sheer number of cut-rate android devices out there, it might be something worth keeping an eye out for

torb main
Jul 28, 2004

SELL SELL SELL
I'm not an Android developer, but I'm trying to setup the Polestar 2 emulator in Android Studio so my office (industry analysts/consultants) can play around with the UI. I know that Android Studio 3.5 included support for Automotive projects, and Polestar made their system image available to developers porting their apps to the Android Automotive platform. However, I'm struggling to get the AVD set up properly as Android Studio isn't recognizing any automotive system images even after they're added in the SDK Update Tools section of SDK Manager.

AVD Manager shows support for Automotive devices:



But when I click Next, I get:



And when I double-check SDK Manager I see this:



Here's Google's wiki on how to set it up, and I don't think I missed anything? What am I doing wrong here?

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Is it under x86 images or Other images at all? Recommended might just be a fixed list, it doesn't always have what you want to use

torb main
Jul 28, 2004

SELL SELL SELL

baka kaba posted:

Is it under x86 images or Other images at all? Recommended might just be a fixed list, it doesn't always have what you want to use

Sorry, should have mentioned all of the tabs are blank and display the same "are you connected to the internet?" error. If I try to create a Phone AVD, it does show the normal Android images correctly. One other hint I'm getting is that if I added the update site appropriately, I feel like I should be seeing some reference to Android Automotive:

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

yeah sorry, I just tried it myself and have the same issue. It's not even showing the images for the default Automotive template, so it doesn't look like a Polestar thing

this is new, right? Maybe they messed something up? I can't find much of any reference to it on the internet

torb main
Jul 28, 2004

SELL SELL SELL

baka kaba posted:

yeah sorry, I just tried it myself and have the same issue. It's not even showing the images for the default Automotive template, so it doesn't look like a Polestar thing

this is new, right? Maybe they messed something up? I can't find much of any reference to it on the internet

Yeah, new with Android Studio 3.5. It was ostensibly demonstrated by Google at IO (fast forward to 24:05):

https://www.youtube.com/watch?v=AHHERLwjUGo

I've gone so far as to examine the provided XML file for the SDK update tools for the path to the actual system image download (warning: many GB). I've downloaded this and manually added it to the system-images path specified in the XML file and AVD Manager still won't recognize it. I guess at this point I just need to send a bug report or something to either Polestar or Google.

torb main fucked around with this message at 00:34 on Sep 4, 2019

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

I'm sure it's google's fault just because even the standard generic profile doesn't list any system images, and that's in their examples

at a guess the experimental flag you have to add for the automotive templates isn't the whole story, or isn't doing what it should. Adding that makes the Automotive section appear in the hardware bit, but it doesn't seem to be able to make any relevant images show up. I tried updating the emulator since the release today said it added support for Automotive images, but nope. If it's only been added that recently though, maybe there'll be a quick fix

torb main
Jul 28, 2004

SELL SELL SELL

baka kaba posted:

I'm sure it's google's fault just because even the standard generic profile doesn't list any system images, and that's in their examples

at a guess the experimental flag you have to add for the automotive templates isn't the whole story, or isn't doing what it should. Adding that makes the Automotive section appear in the hardware bit, but it doesn't seem to be able to make any relevant images show up. I tried updating the emulator since the release today said it added support for Automotive images, but nope. If it's only been added that recently though, maybe there'll be a quick fix

Ugh, thanks for checking. I would have expected to find some sort of thread on this on xda or some other developer forum, but there just aren't enough people using the functionality yet I guess, especially considering you can't even distribute an app to any devices yet. I'll keep loving around with it, I guess :suicide:

Adbot
ADBOT LOVES YOU

FAT32 SHAMER
Aug 16, 2012



We had a hell of a time getting it to work and ended up just flashing the image to a physical mock head unit

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply